
function Block(left,top,color,index){
//	this.color=colors[rand(0,colors.length-1)];
	this.color=color;
	this.width=60;
	this.height=20;
	this.left=left;
	this.top=top;
	this.div=null;
	this.index=index;
}
Block.prototype={
	create:function(){
		var div=document.createElement('div');
		div.className='blos';
		div.style.backgroundColor=this.color;
		div.style.left=this.left+'px';
		div.style.top=this.top+'px';
		this.div=div;
		wrap.appendChild(div);
	},
	checkhit:function(ball){
		if(ball){
			if(ball.left>this.left && ball.left<this.left+this.width-ball.radio*2 && ball.top<=this.top+this.height+3 && ball.top>=this.top+3){
				this.remove();
				ball.ya*=-1;
			}
		}
	},
	remove:function(){
		//移除自己
		wrap.removeChild(this.div);
		var that=this;
		blocks.forEach(function(item,index){
			if(item.index==that.index){
				blocks.splice(index,1);
			}
		})
	}
}
